package application.manager.annotationManager;

import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * 此对象为单例对象，用于管理需要自动关闭的类的对象
 */
public class AutoCloseManager {

    private static AutoCloseManager autoCloseManager = new AutoCloseManager();

    /**
     * 存放需要自动关闭的类的对象集合
     */
    @Getter
    private Map<Class<?>, Object> autoCloses;

    private AutoCloseManager() {
        autoCloses = new HashMap<>();
    }

    public static AutoCloseManager getInstance() {
        if (autoCloseManager == null) {
            autoCloseManager = new AutoCloseManager();
        }
        return autoCloseManager;
    }
}
